package com.bjc.platform.util;

import org.apache.commons.lang.StringUtils;

public class SqlUtil {

	/** 封装like参数, 对特殊字符做处理 
	 * @param s
	 * @return
	 */
	public static String wrapperLike(String s) {
		if (StringUtils.isBlank(s))
			return "%";

		s = s.replaceAll("\\\\", "\\\\\\\\").replaceAll("'", "\'")
				.replaceAll("%", "\\\\%").replaceAll("_", "\\\\_")
				.replaceAll("]", "]]");

		return "%" + s + "%";
	}

}
